package com.cms.jy.draft.util;

import com.cms.jy.draft.entity.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.IOException;

/**
 * 草稿配置写入工具类
 */
public class DraftConfigWriter {
    
    private static final ObjectMapper objectMapper = new ObjectMapper();
    
    /**
     * 写入草稿内容配置
     * @param draftContent DraftContent 对象
     * @param filePath 文件路径
     * @throws IOException IO异常
     */
    public static void writeDraftContent(DraftContent draftContent, String filePath) throws IOException {
        objectMapper.writeValue(new File(filePath), draftContent);
    }
    
    /**
     * 写入草稿元信息配置
     * @param draftMetaInfo DraftMetaInfo 对象
     * @param filePath 文件路径
     * @throws IOException IO异常
     */
    public static void writeDraftMetaInfo(DraftMetaInfo draftMetaInfo, String filePath) throws IOException {
        objectMapper.writeValue(new File(filePath), draftMetaInfo);
    }
    
    /**
     * 写入草稿代理配置
     * @param draftAgencyConfig DraftAgencyConfig 对象
     * @param filePath 文件路径
     * @throws IOException IO异常
     */
    public static void writeDraftAgencyConfig(DraftAgencyConfig draftAgencyConfig, String filePath) throws IOException {
        objectMapper.writeValue(new File(filePath), draftAgencyConfig);
    }
    
    /**
     * 写入草稿虚拟存储配置
     * @param draftVirtualStore DraftVirtualStore 对象
     * @param filePath 文件路径
     * @throws IOException IO异常
     */
    public static void writeDraftVirtualStore(DraftVirtualStore draftVirtualStore, String filePath) throws IOException {
        objectMapper.writeValue(new File(filePath), draftVirtualStore);
    }
    
    /**
     * 写入草稿设置配置
     * @param draftSettings DraftSettings 对象
     * @param filePath 文件路径
     * @throws IOException IO异常
     */
    public static void writeDraftSettings(DraftSettings draftSettings, String filePath) throws IOException {
        DraftSettingsWriter.writeDraftSettings(draftSettings, filePath);
    }
}